﻿using UnityEngine;
using System.Collections;

public class submarino_andando : MonoBehaviour {
	public int velx;
	Vector3 initialPosition;


	// Use this for initialization
	void Start () 
	{	
		initialPosition = transform.position;	
	}
	
	// Update is called once per frame
	void Update () 
	{
		transform.position += new Vector3(velx * Time.deltaTime, 0, 0);
		if(transform.position.x > 12)
		{
			transform.position = new Vector3(initialPosition.x, Random.Range(1.1f, -4.6f), 0);
		}
		
	}
}
